package com.qst.controller;

import com.qst.pojo.Employee;
import com.qst.service.ApproveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author KungSu.
 * @create 2021-06-18 9:49
 */
@Controller
public class ApproveController {
    @Autowired
    ApproveService approveService;

    @RequestMapping("/findStatus")
    public String findStatus(Model model) {
        List<Employee> employees = approveService.findStatus();
        model.addAttribute("emp", employees);
        return "approveaccount";
    }

    @RequestMapping("/passEmp")
    public String passEmp(Model model, Integer employeeid) {
        approveService.setStatues(employeeid);
        findStatus(model);
        return "approveaccount";
    }

    @RequestMapping("/delEmp")
    public String delEmp(Model model, Integer employeeid) {
        approveService.delEmp(employeeid);
        this.findStatus(model);
        return "approveaccount";
    }
}
